Dimensions a variable or an array at the global level (that is, not within a subroutine or function), so that the variable and the array are valid in all libraries and modules for the current session.
変数や配列を (1 つのサブルーチンや関数内部に限定するのではなく) 大域レベルで定義し、現在のセッションにおけるすべてのライブラリやモジュールで使用可能にします。
Global VarName[(start To end)] [As VarType][, VarName2[(start To end)] [As VarType][,...]]
Global VarName[(start To end)] [As VarType][, VarName2[(start To end)] [As VarType][,...]]
Global iGlobalVar As Integer
Global iGlobalVar As Integer
Sub ExampleGlobal
Sub ExampleGlobal
iGlobalVar = iGlobalVar + 1
iGlobalVar = iGlobalVar + 1
MsgBox iGlobalVar
MsgBox iGlobalVar
End sub
End sub